<?php
  $yhendus=new mysqli("localhost", "if13", "ifikad", "if13_Martin");
  if(isSet($_REQUEST["kasutaja_lisa"])){
    $kask=$yhendus->prepare("INSERT INTO ISIK (ENIMI, PNIMI, EMAIL) VALUES (?, ?, ?)");
    $kask->bind_param("sss", $_REQUEST["eesnimi"], $_REQUEST["perenimi"], $_REQUEST["email"]);
    $kask->execute();
    header("Location: $_SERVER[PHP_SELF]");
    $yhendus->close();
    exit();
  }
?>
<!doctype html>
<html>
	<head>
		<title>Peoleht</title>
	</head>
	<body>
	<?php
	require "pais.php";
	?>
	<h1>Registreerimine</h1>
		<form action='?'>
			<input type="hidden" name="kasutaja_lisa" value="jah"/>
			<dl>
				<dt>Eesnimi:</dt>
				<dd>
					<input type="text" name="eesnimi"/>
				</dd>
				<dt>Perekonnanimi</dt>
				<dd>
					<input type="text" name="perenimi"/>
				</dd>
				<dt>Email</dt>
				<dd>
					<textarea name="email"></textarea>
				</dd>
			</dl>
			<input type="submit" value="Registreeru">
			<?php
			?>
		</form>
		
	</body>
	
	
</html>